"""setting global parameters"""

import numpy as np

ARRIVAL_RATE = 1
ERLANG_ORDER = 4
ERLANG_RATE = 3 * 2 / 1.5
SERVICE_RATE = ERLANG_RATE / ERLANG_ORDER

RESERVE_CAPACITY = 20  # CAPACITY IN THE RESERVE AREA
NUM_STATES = RESERVE_CAPACITY + 1
MAX_INSPECT = 1  # MAXIMUM INSPECTION RANGE
MIN_INSPECT = 0.1  # MINIMUM INSPECTION RANGE
DELTA = 0.01  # INSPECTION ACCURACY
NUM_ACTIONS = int((MAX_INSPECT - MIN_INSPECT) / DELTA + 3)

K1 = 0.1 * 1  # RESERVE COST PER UNIT TIME
K2 = 0.5 * 10  # SERVING COST PER UNIT TIME
K3 = 1 / 1  # WAITING COST PER UNIT TIME
K4 = -10  # REWARD FOR EACH UNIT PROCESSED
K5 = 0.2 * 1  # INSPECTION COST PER UNIT RANGE

EYE, ONES = np.eye(NUM_STATES), np.ones([NUM_STATES, 1])
ALPHA = 0.001
LAMBDA = 0.9995

EPOCH = 500
EPOCH_LEARN = 100
DISCOUNT = 1
Q_AVE_STEP = 0.6
Q_FACTOR_STEP = 0.7

EPSILON_1 = 0.2
EPSILON_2 = 0.2
EPSILON_RATE = - 2 * np.log(EPSILON_2 / EPSILON_1) / EPOCH
EPSILON_END = 0.01

"""PARAMETERS FOR DQN"""
BATCH_SIZE = 32  # BATCH SIZE FOR TRAINING
LR = 0.01  # LEARNING RATE
GAMMA = 0.90  # DISCOUNT FACTOR FOR DQN
MEMORY_CAPACITY = 200  # CAPACITY OF EXPERIENCE REPLAY
Q_NETWORK_ITERATION = 200  # INNER ITERATIONS
